1. Technical Field
The present invention provides an improved data processing system and in particular, a method and apparatus for compiling instructions. Still more particularly, the present invention provides a method and apparatus for compiling instructions for different modes of addressing.
2. Description of Related Art
Java is an object oriented programming language and environment focusing on defining data as objects and the methods that may be applied to those objects. xe2x80x9cJavaxe2x80x9d is a trademark of Sun Microsystems, Inc. Java supports only a single inheritance, meaning that each class can inherit from only one other class at any given time. Java also allows for the creation of totally abstract classes known as interfaces, which allow the defining of methods that may be shared with several classes without regard for how other classes are handling the methods. Java provides a mechanism to distribute software to different computing platforms.
Java is able to support applications for many types of data processing systems, which may contain a variety of central processing units and operating system architectures. The Java Virtual Machine (JVM) is a virtual computer component that resides only in memory. The JVM allows Java programs to be executed on different platforms as opposed to only the one platform for which the code was compiled. Java programs are compiled for the JVM. In this manner, Java is able to support applications for many types of data processing systems, which may contain a variety of central processing units and operating systems architectures. To enable a Java application to execute on different types of data processing systems, a compiler typically generates an architecture-neutral file format. The compiled code is executable on many processors, given the presence of the Java runtime system. The Java compiler generates bytecode instructions that are non-specific to particular computer architectures. A bytecode is a machine independent code generated by the Java compiler and executed by a Java interpreter. A Java interpreter is a module in the JVM that alternatively decodes and executes a bytecode or bytecodes. These bytecode instructions are designed to be easy to interpret on any machine and easily translated on the fly into native machine code.
A development environment, such as the Java Development Kit (JDK) available from Sun Microsystems, Inc., may be used to build Java bytecode from Java language source code and libraries. This Java bytecode may be stored as a Java application or applet on a Web Server, where it can be downloaded over a network to a user""s machine and executed on a local JVM. When extra speed in executing a Java program is needed, a Just In Time (JIT) compiler may be used to translate bytecodes for a method or class into native machine instructions before executing them. This can occur as late as when a method is first executed, or possibly later still, on a subsequent method invocation, with previous method invocations being interpreted rather executing compiled code.
Some operating systems are able to run applications in more than one addressing mode. For example, with 64-bit processors, some operating systems may run an application program in one mode in which the application has full access to the 64-bit address space. In another mode, addresses are only 32-bits in size. This 32-bit addressing mode is used for compatibility reasons. This mode makes porting applications from other 32-bit operating systems easier because C language pointers remain the same size as integers. In one such operating system, Advanced Interactive Executive (AIX) 5L for IA-64, a product of International Business Machines Corporation in Armonk, N.Y., the same instructions are used in 32-bit mode, and all of the registers are the same size as in 64-bit mode. In 32-bit mode, pointer variables are read as 32-bit quantities from memory and are extended to 64-bit values in registers before they are used.
With these different types of addressing modes, JIT compilers are required to be designed for particular modes of addressing. Presently, different JIT compilers are designed and built for 32-bit mode addressing and 64-bit mode addressing.
Therefore, it would be advantageous to have an improved method and apparatus for a compiler that is capable of running in different modes of addressing and generate code, which can be executed in that mode.
The present invention provides a process in a data processing system for just-in-time compiling instructions. A set of non-specific data processing system instructions for a method are received. Addresses are placed into a set of functions. The set of non-specific data processing system instructions are processed using an intermediate code generation process to generate a set of instructions for execution using a particular mode of addressing.